<template>
    
<div id="app">
<el-row class="sidebar">
  <el-col :span="12">
    <h5>菜单栏</h5>
    <el-menu
      default-active="1"
      
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">

      <el-menu-item index="1">
        <i class="el-icon-menu"></i>
        <span slot="title">查看所有问卷</span>
      </el-menu-item>

      <el-menu-item index="2" >
        <i class="el-icon-document"></i>
        <span slot="title">创建新的问卷</span>
      </el-menu-item>

      <el-menu-item index="3">
        <i class="el-icon-setting"></i>
        <span slot="title">查看已发布问卷</span>
      </el-menu-item>

      <el-menu-item index="4">
        <i class="el-icon-setting"></i>
        <span slot="title">查看未发布问卷</span>
      </el-menu-item>

    </el-menu>
  </el-col>
</el-row>
</div>
    
</template>

<script>
  export default {
    data() {
      return {
        activeIndex: '1',
        activeIndex2: '2',
        account:{  //登录的帐号密码
              userId:'',
              pwd: '',
              userName:'',
              nickName:''
        },
          
      };
    },
    methods: {
        //可以在这里处理点击事件
      handleSelect(key, keyPath) {

          //点击问卷风事件
        if(key==1){

            console.log("查看所有问卷");
            this.$router.push('/home/queryall');
          }
        else if(key==2){
            console.log("创建新问卷");
            this.$router.push('/home/create');
        }
        else if(key==3){
            console.log("查看已发布问卷");
            this.$router.push('/home/queryRelease');
        }
        else if(key==4){
             console.log("查看未发布问卷");
             this.$router.push('/home/queryNotRelease');
        }

      }
    },
    created () {
        // console.log(this.$store.state.account);
         console.log(sessionStorage.nickName);
        this.account.userName=sessionStorage.userName;
        this.account.nickName=sessionStorage.nickName;

    }
  }
</script>
<style >
.sidebar{
    list-style-type: none;
    margin: 0;
    padding: 0;
    width: 430px;
    top: -20px; /*定义高度 */
    float: left;
}
</style>